#pragma once

#include <qdebug.h>
#include <QVector>
#include <QTimer>
#include <WalkForwardInstruction.h>
#include <WalkRotateInstruction.h>
#include <WalkStrafeInstruction.h>
#include <AiboState.h>

class WalkInstructionHandler : public QObject
{
    Q_OBJECT
public:
	WalkInstructionHandler(AiboState* aiboState);
	~WalkInstructionHandler(void);

	bool isForwardOn() { return m_forwardOn; }
	bool isRotateOn() { return m_rotateOn; }
	bool isStrafeOn() { return m_strafeOn; }

	bool addInstruction( WalkInstruction wInstruction );
	void resetAiboState();
	void sendGeneralInstruction( WalkInstruction* instruction );
	bool sendInstruction( WalkForwardInstruction* forwardInstruction );
	bool sendInstruction( WalkRotateInstruction* rotateInstruction );
	bool sendInstruction( WalkStrafeInstruction* strafeInstruction );

	void updateAiboState();

private:
	AiboState* getAiboState() { return m_aiboState; }
	void setAiboState( AiboState *aiboState ) { m_aiboState = aiboState; }
	QVector<WalkInstruction>* getInstructionList() { return m_walkInstructionList; }
	void turnForwardOn() { m_forwardOn = true; }
	void turnRotateOn() { m_rotateOn = true; }
	void turnStrafeOn() { m_strafeOn = true; }

	void turnForwardOff() { m_forwardOn = false; }
	void turnRotateOff() { m_rotateOn = false; }
	void turnStrafeOff() { m_strafeOn = false; }

	QTimer *aiboStateTimer;

	AiboState* m_aiboState;
	QVector<WalkInstruction> *m_walkInstructionList;
	bool m_forwardOn;
	bool m_rotateOn;
	bool m_strafeOn;
};

